﻿using System;
using System.Collections.Generic;
using Allegro.MathInterface;

namespace Allegro.Mathlib
{
    /// <summary>
    /// Compute the Jacobian matrix using numerical differentiation
    /// </summary>
    public class Jacobian
    {
        private double[] _stepSizes;
        private IDifferentiation _diffMethod;
        private VectorMap _f;
        private Gradient[] _gradientVector;
        private int _n;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="f"></param>
        /// <param name="diffMethod"></param>
        /// <param name="stepSizes"></param>
        public Jacobian(VectorMap f, IDifferentiation diffMethod, double[] stepSizes)
        {
            _n = stepSizes.Length;
            _f = f;
            _diffMethod = diffMethod;
            _stepSizes = stepSizes;
            _gradientVector = new Gradient[_n];
            for(int i = 0; i <_n; i++)
            {
                //_gradientVector[i] = new Gradient();
            }
            throw new NotImplementedException("Jacobian not implemented");
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="f"></param>
        /// <param name="stepSizes"></param>
        public Jacobian(VectorMap f,double[] stepSizes) 
            : this(f, new RiddersDifferentiationMethod(), stepSizes)
        {
        }
        /// <summary>
        /// Compute the Jacobi matrix at x
        /// </summary>
        /// <param name="x"></param>
        /// <param name="dfdx">Jacobi matrix</param>
        public void Df(double[] x, double[,] dfdx)
        {
        }

        // Private methods
        //double _fi(double[] x)
        //{
            
        //}
    }
}
